This section describes the functions that you must provide to implement a tween component. QuickTime calls these functions when it uses your component.
The TweenerInitialize function is called to initialize your tween component for a single tween operation.
extern pascal ComponentResult TweenerInitialize(
TweenerComponent tc,
QTAtomContainer container,
QTAtom tweenAtom,
QTAtom dataAtom)
This function sets up the tween component when it is first used. In your TweenerInitialize function, you can allocate storage and set up any structures that you need for the duration of a tween operation. Although the container that holds the data atom is available during each call to the TweenerDoTween function, you can improve the performance of your tween component by extracting the data to be used by the TweenerDoTween function in the TweenerInitialize function.
The data atom parameter is provided as a convenience; you can also call QT atom container functions to locate the data atom in the container. For more information about the QT atom container functions, see the chapter "Movie Toolbox" in this book.
The TweenerReset function is called to clean up when the tween operation is finished.
extern pascal ComponentResult TweenerReset (TweenerComponent tc)
This function releases storage allocated by the tween component when the component is no longer being used. The TweenerReset function should release any storage allocated by the TweenerInitialize function and close or release any other resources used by the component. A tween component may receive a tweener initialize or a close call after being reset.
The TweenerDoTween function is called to perform a tween operation.
extern pascal ComponentResult TweenerDoTween(
TweenerComponent tc,
TweenRecord *tr)
QuickTime calls this function to interpolate the data used during a tween operation. The tween record contains complete information about the tween operation, including the start and end values for the operation and a percentage that indicates the progress towards completion of the tween sample. For more information about the structure of a tween record, see "Tween Record" .
Your TweenerDoTween function should use the information in the tween record to calculate the tweened value. TweenerDoTween should call the data function specified in the tween record, passing it the tweened value. For more information about the data procedure, see "Value Setting Function" .